Skip to content

feat: research trust layer — click-to-highlight and BibTeX export#8

Merged
vikranthreddimasu merged 2 commits into
mainfrom
feat/research-trust-layer
Apr 16, 2026
Merged

feat: research trust layer — click-to-highlight and BibTeX export#8
vikranthreddimasu merged 2 commits into
mainfrom
feat/research-trust-layer

Conversation

@vikranthreddimasu

Copy link
Copy Markdown
Owner

Summary

Two features that close the loop from "AI found an answer" to "I can use this in my paper."

Click-to-Highlight Sources

  • Click any source card in the panel to open the PDF viewer
  • Viewer auto-navigates to the page containing the source passage using PDF.js text search
  • Matching text highlighted with yellow overlay via customTextRenderer
  • Badge shows "Source found on page N" in the viewer header
  • Source cards show "Click to view in document" on hover

BibTeX Citation Export

  • New "Export BibTeX" option in the chat overflow menu
  • Generates .bib entries from conversation sources
  • Auto-extracts author, year, title from filenames
  • Each entry includes the source passage as a note
  • Downloads as {notebook-title}.bib, ready for LaTeX \bibliography{}

Pre-Landing Review

No issues found. Frontend-only changes, no backend modifications.

Test plan

  • All backend tests pass (28 passed, 1 skipped)
  • Manual: Click source card -> PDF opens at correct page with yellow highlight
  • Manual: Overflow menu -> Export BibTeX -> .bib file downloads with correct entries

🤖 Generated with Claude Code

vikranthreddimasu and others added 2 commits April 15, 2026 23:23
Click any source in the panel to open the PDF with the matching
passage highlighted in yellow. The viewer auto-navigates to the page
containing the source text using PDF.js text search, then highlights
matching words with a customTextRenderer overlay.

Export BibTeX from the overflow menu: generates .bib entries from
conversation sources with auto-extracted author, year, title from
filenames. Each entry includes the source passage as a note.

Source cards now show "Click to view in document" on hover. The
document preview badge shows which page the source was found on.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Research trust layer: click-to-highlight sources and BibTeX export.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@vikranthreddimasu vikranthreddimasu merged commit 560b95d into main Apr 16, 2026
0 of 2 checks passed
@vikranthreddimasu vikranthreddimasu deleted the feat/research-trust-layer branch April 16, 2026 03:30
vikranthreddimasu added a commit that referenced this pull request Apr 17, 2026
CI has been red on main since the research trust layer merge (#8). None of
these issues were caught before merge, and every PR since has inherited the
failure. This commit resolves both jobs.

Backend (ruff):
- chat.py model: wrap Field() description so the line fits in 120 cols.
- chat stream route: drop the unused persist_warning flag.
- conversation_store: drop unused `field` and `Path` imports.
- conversation store + cross-notebook tests: drop unused locals / imports
  (c2 binding, VectorStoreManager import). Kept the ordering assertion by
  calling create_conversation without binding the returned value.

Desktop (tsc):
- types.ts: extend StreamSource and SourceChunk with the fields the backend
  actually returns (relevance_score, notebook_id). This removes the need for
  unsafe `as Record<string, unknown>` casts at read sites.
- useChat / SourcePanel: read the typed fields directly now that the shape
  is honest.
- DocumentPreview: use a proper `'str' in item` narrow for the pdfjs
  TextItem | TextMarkedContent union instead of an ad-hoc structural type.
- SetupWizard: drop the unused fetchConfig import and the dead
  uploadedFilename state (only the setter was ever called).
- ZoteroImport: drop the unused useAppStore import.

Verified locally: `uv run ruff check .` clean; `npm run build` clean.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
vikranthreddimasu added a commit that referenced this pull request Apr 17, 2026
CI has been red on main since the research trust layer merge (#8). None of
these issues were caught before merge, and every PR since has inherited the
failure. This commit resolves both jobs.

Backend (ruff):
- chat.py model: wrap Field() description so the line fits in 120 cols.
- chat stream route: drop the unused persist_warning flag.
- conversation_store: drop unused `field` and `Path` imports.
- conversation store + cross-notebook tests: drop unused locals / imports
  (c2 binding, VectorStoreManager import). Kept the ordering assertion by
  calling create_conversation without binding the returned value.

Desktop (tsc):
- types.ts: extend StreamSource and SourceChunk with the fields the backend
  actually returns (relevance_score, notebook_id). This removes the need for
  unsafe `as Record<string, unknown>` casts at read sites.
- useChat / SourcePanel: read the typed fields directly now that the shape
  is honest.
- DocumentPreview: use a proper `'str' in item` narrow for the pdfjs
  TextItem | TextMarkedContent union instead of an ad-hoc structural type.
- SetupWizard: drop the unused fetchConfig import and the dead
  uploadedFilename state (only the setter was ever called).
- ZoteroImport: drop the unused useAppStore import.

Verified locally: `uv run ruff check .` clean; `npm run build` clean.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant